Skip to content

feat: say when a log shows only its first characters - #9631

Merged
koenvanderveen merged 5 commits into
devfrom
atlaie/enclave-msg-log-head-note
Nov 19, 2026
Merged

koenvanderveen merged 5 commits into
devfrom
atlaie/enclave-msg-log-head-note

Conversation

@atlaie

@atlaie atlaie commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • When a reader of an enclave job has only the first N characters of a log, job.stderr and job.stdout previously showed the text as if it were the whole log. Now the repr and the notebook title add "(first N characters, released by the data owners)". When the copy is shorter than N, it is the whole log, and the note adds its length. str(job.stderr) is still only the log text.

Guidelines

High level

  • 🟢 Split: no need to split.
  • 🟢 Size: say when a log viewer shows only the first characters of the log.

Mid level

  • 🟢 User-facing code
  • 🟢 Error handling
  • 🟢 State versioning
  • 🟢 Function structure
  • 🟢 Tests

Low level

  • 🟠 Naming: the viewers in job_repr.py and job_stdout.py call the private _log_note() from outside the class; make it public.
  • 🟢 Code style

Security

No change. The note is escaped before it goes into the HTML.

Testing

  • test_requested_stderr_head_reaches_submitter checks the note in the repr and the HTML.
  • test_log_head_longer_than_log_says_it_is_whole checks the length in the note.
  • test_log_request_defaults_to_data_owners checks that the whole log has no note.

Asana task

Original description

When a reader has only the first N characters of a log, job.stderr / job.stdout now say so in the repr and the notebook title:

stderr.txt (first 200 characters, released by the data owners)

When the copy is shorter than N, it is the whole log, and the note adds its length. str(job.stderr) is still the log text alone. Display only; no behaviour change.

One of five small PRs from the 13 Nov enclave test; each merges cleanly with the others and with #9576.

Asana: https://app.asana.com/0/0/1220519978965332/f

🤖 Generated with Claude Code

No rush: after the release.

job.stderr / job.stdout (repr and notebook view) say when they show only
the first N characters that the data owners released, and the whole
length when the copy is shorter than asked for.

Messages, display and docstrings only; no behaviour change.
Asana: https://app.asana.com/0/0/1220519978965332/f

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
JobInfo.log_is_truncated() is always False. EnclaveJobInfo returns True
when the readers have a copy of the first N chars that is N chars long.
When a log is truncated, the stdout and stderr viewers add
LOG_TRUNCATION_MESSAGE at the end of the log in the repr and the
notebook view.
@koenvanderveen
koenvanderveen marked this pull request as ready for review November 19, 2026 14:39
@koenvanderveen
koenvanderveen merged commit dc0d3a4 into dev Nov 19, 2026
18 of 19 checks passed
@koenvanderveen
koenvanderveen deleted the atlaie/enclave-msg-log-head-note branch November 19, 2026 14:39
yermakoffivan pushed a commit to yermakoffivan/pysyft that referenced this pull request Nov 19, 2026
PR OpenMined#9631 made the stdout and stderr viewers call
job_info.log_is_truncated(). The fakes in test_job_stdout.py, added by
PR OpenMined#9587, did not have it, so job-tests failed on dev.
yermakoffivan pushed a commit to yermakoffivan/pysyft that referenced this pull request Nov 19, 2026
PR OpenMined#9631 had _log_note() return a note or None, where None meant
'add nothing'. Its PR description rated function structure green,
because the guideline read as being about functions that do something.
Add this case and an example to the guideline.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants